package com.datang.springcode.beanFactoryPostProcessorTest;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;

@Component
public class BeanFactoryPostProcessor2 implements BeanFactoryPostProcessor, Ordered {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory configurableListableBeanFactory) throws BeansException {
        BeanDefinition pen = configurableListableBeanFactory.getBeanDefinition("money");
        pen.setScope("prototype");
        System.out.println("BeanFactoryPostProcessor2");
    }

    @Override
    public int getOrder() {
        return 2;
    }
}
